home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2001 Haziran
/
CHIP Haziran2001.iso
/
prog
/
haziran
/
19
/
setup.exe
/
data.z
/
pp_gui.frm
< prev
next >
Wrap
Text File
|
2001-04-11
|
36KB
|
1,272 lines
VERSION 5.00
Begin VB.Form pp_gui
BorderStyle = 1 'Fixed Single
Caption = "Prallel Port Sample"
ClientHeight = 3564
ClientLeft = 36
ClientTop = 264
ClientWidth = 6972
Icon = "pp_gui.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3564
ScaleWidth = 6972
StartUpPosition = 3 'Windows Default
Begin VB.CheckBox AutoReadCheck
Caption = "AutoRead"
Height = 252
Left = 120
TabIndex = 2
Top = 720
Value = 1 'Checked
Width = 1092
End
Begin VB.Timer AutoReadClock
Enabled = 0 'False
Interval = 200
Left = 5760
Top = 1200
End
Begin VB.CommandButton About_Button
Caption = "About"
Height = 372
Left = 4800
TabIndex = 5
Top = 120
Width = 972
End
Begin VB.CommandButton Exit_Button
Caption = "Exit"
Height = 372
Left = 5880
TabIndex = 6
Top = 120
Width = 972
End
Begin VB.CommandButton ReadRegisters_Button
Caption = "Read"
Height = 252
Left = 120
TabIndex = 1
Top = 1080
Width = 972
End
Begin VB.ComboBox Destination
Height = 288
ItemData = "pp_gui.frx":030A
Left = 120
List = "pp_gui.frx":0317
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 1332
End
Begin VB.CommandButton WriteControl_Button
Caption = "Write"
Height = 252
Left = 6000
TabIndex = 4
Top = 2880
Width = 732
End
Begin VB.CommandButton WriteData_Button
Caption = "Write"
Height = 252
Left = 1440
TabIndex = 3
Top = 960
Width = 732
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 4080
TabIndex = 12
Top = 2880
Width = 252
End
Begin VB.TextBox Text3
Alignment = 2 'Center
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 3840
TabIndex = 11
Top = 2880
Width = 252
End
Begin VB.TextBox Text4
Alignment = 2 'Center
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 3600
TabIndex = 10
Top = 2880
Width = 252
End
Begin VB.TextBox Text5
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 1776
TabIndex = 9
Top = 2880
Width = 252
End
Begin VB.TextBox Text6
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 2016
TabIndex = 8
Top = 2880
Width = 252
End
Begin VB.TextBox Text7
Appearance = 0 'Flat
Enabled = 0 'False
Height = 252
Left = 2256
TabIndex = 7
Top = 2880
Width = 252
End
Begin VB.Line Line30
X1 = 792
X2 = 792
Y1 = 2088
Y2 = 2810
End
Begin VB.Line Line23
X1 = 996
X2 = 996
Y1 = 2448
Y2 = 2810
End
Begin VB.Line Line13
X1 = 1200
X2 = 1200
Y1 = 2472
Y2 = 2810
End
Begin VB.Line Line3
X1 = 1428
X2 = 1428
Y1 = 2520
Y2 = 2810
End
Begin VB.Line Line34
X1 = 5388
X2 = 5388
Y1 = 1992
Y2 = 2810
End
Begin VB.Line Line55
X1 = 624
X2 = 816
Y1 = 2904
Y2 = 2904
End
Begin VB.Line Line54
X1 = 5304
X2 = 5496
Y1 = 2904
Y2 = 2904
End
Begin VB.Line Line53
X1 = 5076
X2 = 5268
Y1 = 2904
Y2 = 2904
End
Begin VB.Line Line52
Index = 0
X1 = 4596
X2 = 4788
Y1 = 2904
Y2 = 2904
End
Begin VB.Label Status
Caption = "00"
Height = 252
Left = 2676
TabIndex = 39
Top = 2916
Width = 252
End
Begin VB.Label Control
Caption = "00"
Height = 252
Left = 5676
TabIndex = 38
Top = 2904
Width = 252
End
Begin VB.Label Data
Caption = "00"
Height = 252
Left = 4416
TabIndex = 37
Top = 972
Width = 252
End
Begin VB.Line Line1
BorderWidth = 3
Index = 0
X1 = 1200
X2 = 4680
Y1 = 1800
Y2 = 1800
End
Begin VB.Line Line2
BorderWidth = 3
X1 = 1200
X2 = 1560
Y1 = 1800
Y2 = 2400
End
Begin VB.Line Line16
BorderWidth = 3
X1 = 4680
X2 = 4320
Y1 = 1800
Y2 = 2400
End
Begin VB.Line Line29
BorderColor = &H00000000&
BorderWidth = 3
X1 = 1560
X2 = 4320
Y1 = 2400
Y2 = 2400
End
Begin VB.Shape Pin25
Height = 132
Left = 1560
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin24
Height = 132
Left = 1800
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin23
Height = 132
Left = 2040
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin22
Height = 132
Left = 2280
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin21
Height = 132
Left = 2520
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin20
Height = 132
Left = 2760
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin19
Height = 132
Left = 3000
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin18
Height = 132
Left = 3240
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin17
BorderColor = &H0000FFFF&
FillColor = &H0000FFFF&
Height = 132
Left = 3480
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin16
BorderColor = &H0000FFFF&
FillColor = &H0000FFFF&
Height = 132
Left = 3720
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin15
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 132
Left = 3960
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin14
BorderColor = &H0000FFFF&
FillColor = &H0000FFFF&
Height = 132
Left = 4200
Shape = 3 'Circle
Top = 2160
Width = 132
End
Begin VB.Shape Pin13
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 132
Left = 1440
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin12
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 132
Left = 1680
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin11
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 132
Left = 1920
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin10
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 132
Left = 2124
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin9
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 2400
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin8
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 2640
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin7
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 2880
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin6
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 3120
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin5
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 3360
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin4
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 3600
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin3
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 3840
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin2
BorderColor = &H8000000D&
FillColor = &H8000000D&
Height = 132
Left = 4080
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Pin1
BorderColor = &H0000FFFF&
FillColor = &H0000FFFF&
Height = 132
Left = 4320
Shape = 3 'Circle
Top = 1920
Width = 132
End
Begin VB.Shape Shape1
BorderColor = &H8000000C&
Height = 612
Left = 120
Shape = 4 'Rounded Rectangle
Top = 2760
Width = 3012
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "S7"
ForeColor = &H80000008&
Height = 252
Index = 0
Left = 600
TabIndex = 36
Top = 2880
Width = 240
End
Begin VB.Label Label4
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "S6"
ForeColor = &H80000008&
Height = 252
Index = 4
Left = 828
TabIndex = 35
Top = 2880
Width = 252
End
Begin VB.Label Label3
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "S5"
ForeColor = &H80000008&
Height = 252
Index = 5
Left = 1056
TabIndex = 34
Top = 2880
Width = 252
End
Begin VB.Label Label2
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "S4"
ForeColor = &H80000008&
Height = 252
Index = 6
Left = 1296
TabIndex = 33
Top = 2880
Width = 252
End
Begin VB.Label Label1
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "S3"
ForeColor = &H80000008&
Height = 252
Index = 7
Left = 1536
TabIndex = 32
Top = 2880
Width = 252
End
Begin VB.Label Status_Lable
BackColor = &H8000000A&
Caption = " Status"
Height = 252
Left = 192
TabIndex = 31
Top = 2580
Width = 528
End
Begin VB.Label Label6
Caption = "= "
Height = 252
Index = 0
Left = 2544
TabIndex = 30
Top = 2904
Width = 108
End
Begin VB.Shape Shape2
BorderColor = &H8000000C&
Height = 612
Left = 3480
Shape = 4 'Rounded Rectangle
Top = 2760
Width = 3372
End
Begin VB.Label Control_Label
Caption = " Control"
Height = 252
Left = 3576
TabIndex = 29
Top = 2580
Width = 612
End
Begin VB.Label Label8
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "C3"
ForeColor = &H80000008&
Height = 252
Index = 0
Left = 4560
TabIndex = 28
Top = 2880
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "C2"
ForeColor = &H80000008&
Height = 252
Index = 4
Left = 4800
TabIndex = 27
Top = 2880
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "C0"
ForeColor = &H80000008&
Height = 252
Index = 5
Left = 5280
TabIndex = 26
Top = 2880
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "C1"
ForeColor = &H80000008&
Height = 252
Index = 6
Left = 5040
TabIndex = 25
Top = 2880
Width = 252
End
Begin VB.Label Label6
Caption = "= "
Height = 252
Index = 1
Left = 5556
TabIndex = 24
Top = 2892
Width = 96
End
Begin VB.Line Line8
X1 = 2460
X2 = 2460
Y1 = 2580
Y2 = 2088
End
Begin VB.Line Line9
X1 = 2460
X2 = 4032
Y1 = 2100
Y2 = 2100
End
Begin VB.Line Line10
X1 = 4032
X2 = 4032
Y1 = 2100
Y2 = 2172
End
Begin VB.Line Line4
X1 = 1428
X2 = 2244
Y1 = 2520
Y2 = 2520
End
Begin VB.Line Line5
X1 = 2244
X2 = 2244
Y1 = 2520
Y2 = 2124
End
Begin VB.Line Line6
X1 = 2244
X2 = 2376
Y1 = 2124
Y2 = 2124
End
Begin VB.Line Line7
X1 = 2376
X2 = 2376
Y1 = 2124
Y2 = 1824
End
Begin VB.Line Line11
X1 = 2376
X2 = 1500
Y1 = 1836
Y2 = 1836
End
Begin VB.Line Line12
X1 = 1500
X2 = 1500
Y1 = 1836
Y2 = 1908
End
Begin VB.Line Line14
X1 = 1200
X2 = 2184
Y1 = 2472
Y2 = 2472
End
Begin VB.Line Line15
X1 = 2184
X2 = 2184
Y1 = 2472
Y2 = 2100
End
Begin VB.Line Line17
X1 = 2184
X2 = 2316
Y1 = 2100
Y2 = 2100
End
Begin VB.Line Line18
X1 = 2316
X2 = 2316
Y1 = 2100
Y2 = 1872
End
Begin VB.Line Line19
X1 = 1740
X2 = 2316
Y1 = 1884
Y2 = 1884
End
Begin VB.Line Line20
X1 = 1740
X2 = 1740
Y1 = 1884
Y2 = 1932
End
Begin VB.Line Line21
X1 = 2460
X2 = 1680
Y1 = 2580
Y2 = 2580
End
Begin VB.Line Line22
X1 = 1680
X2 = 1680
Y1 = 2580
Y2 = 2810
End
Begin VB.Line Line24
X1 = 996
X2 = 1740
Y1 = 2436
Y2 = 2436
End
Begin VB.Line Line25
X1 = 1740
X2 = 1740
Y1 = 2436
Y2 = 2124
End
Begin VB.Line Line26
X1 = 1740
X2 = 2076
Y1 = 2124
Y2 = 2124
End
Begin VB.Line Line27
X1 = 2076
X2 = 2076
Y1 = 1980
Y2 = 2136
End
Begin VB.Line Line28
X1 = 2076
X2 = 2136
Y1 = 1980
Y2 = 1980
End
Begin VB.Line Line31
X1 = 792
X2 = 1860
Y1 = 2076
Y2 = 2076
End
Begin VB.Line Line32
X1 = 1848
X2 = 1848
Y1 = 1968
Y2 = 2088
End
Begin VB.Line Line33
X1 = 1848
X2 = 1908
Y1 = 1968
Y2 = 1968
End
Begin VB.Line Line35
X1 = 4464
X2 = 5388
Y1 = 1992
Y2 = 1992
End
Begin VB.Line Line36
X1 = 5160
X2 = 5160
Y1 = 2220
Y2 = 2810
End
Begin VB.Line Line37
X1 = 4356
X2 = 5160
Y1 = 2220
Y2 = 2220
End
Begin VB.Line Line38
X1 = 3780
X2 = 4920
Y1 = 2460
Y2 = 2460
End
Begin VB.Line Line39
X1 = 4920
X2 = 4920
Y1 = 2460
Y2 = 2810
End
Begin VB.Line Line40
X1 = 3780
X2 = 3780
Y1 = 2304
Y2 = 2460
End
Begin VB.Line Line41
X1 = 3540
X2 = 4680
Y1 = 2568
Y2 = 2568
End
Begin VB.Line Line42
X1 = 4680
X2 = 4680
Y1 = 2568
Y2 = 2810
End
Begin VB.Line Line43
X1 = 3540
X2 = 3540
Y1 = 2292
Y2 = 2568
End
Begin VB.Shape Shape3
BorderColor = &H8000000C&
Height = 612
Left = 1320
Shape = 4 'Rounded Rectangle
Top = 840
Width = 3852
End
Begin VB.Label Data_Label
Caption = " Data"
Height = 252
Left = 1416
TabIndex = 23
Top = 660
Width = 456
End
Begin VB.Label Label6
Caption = "="
Height = 252
Index = 3
Left = 4296
TabIndex = 22
Top = 984
Width = 96
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D6"
ForeColor = &H80000008&
Height = 252
Index = 1
Left = 2580
TabIndex = 21
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D0"
ForeColor = &H80000008&
Height = 252
Index = 2
Left = 4020
TabIndex = 20
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D1"
ForeColor = &H80000008&
Height = 252
Index = 3
Left = 3780
TabIndex = 19
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D2"
ForeColor = &H80000008&
Height = 252
Index = 7
Left = 3540
TabIndex = 18
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D3"
ForeColor = &H80000008&
Height = 252
Index = 8
Left = 3300
TabIndex = 17
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D4"
ForeColor = &H80000008&
Height = 252
Index = 9
Left = 3060
TabIndex = 16
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D5"
ForeColor = &H80000008&
Height = 252
Index = 10
Left = 2820
TabIndex = 15
Top = 960
Width = 252
End
Begin VB.Label Label5
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Caption = "D7"
ForeColor = &H80000008&
Height = 252
Index = 11
Left = 2340
TabIndex = 14
Top = 960
Width = 252
End
Begin VB.Line Line44
Index = 0
X1 = 2460
X2 = 2460
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line45
X1 = 2700
X2 = 2700
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line46
X1 = 2940
X2 = 2940
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line47
X1 = 3180
X2 = 3180
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line48
X1 = 3420
X2 = 3420
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line49
X1 = 3672
X2 = 3672
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line50
X1 = 3912
X2 = 3912
Y1 = 1260
Y2 = 1908
End
Begin VB.Line Line51
X1 = 4152
X2 = 4152
Y1 = 1260
Y2 = 1908
End
Begin VB.Label Label10
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
Enabled = 0 'False
ForeColor = &H80000008&
Height = 252
Index = 0
Left = 4320
TabIndex = 13
Top = 2880
Width = 252
End
End
Attribute VB_Name = "pp_gui"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
' File - pp_gui.frm
'
' This application reads and writes data to the Parallel Port, and is
' controlled via a graphical user interface - pp_gui.frm
' The Parallel Port is accessed directly on the motherboard, using
' WinDriver functions.
'
Dim hPP As PP_HANDLE
Dim active_base_addr As Long
Private Sub About_Button_Click()
MsgBox "Parallel Port v1.0" & Chr$(13) & Chr$(13) & _
"This sample accesses the Parallel Port" & Chr$(13) _
& " through the WinDriver's Visual Basic interface." _
& Chr$(13) & Chr$(13) & "Copyright (c) 2000 Jungo" _
, vbOKOnly, "About the Parallel Port Sample "
End Sub
Private Sub AutoReadCheck_Click()
If (pp_gui.AutoReadCheck.Value = 0) Then
pp_gui.AutoReadClock = False
Else
pp_gui.AutoReadClock = True
End If
End Sub
Private Sub Exit_Button_Click()
If (active_base_addr <> 0) Then
PP_Close hPP
End If
Unload pp_gui
End Sub
Private Sub Form_Load()
pp_gui.Destination.ListIndex = 0
If (Not IsPPOpen(hPP)) Then
Unload pp_gui
End If
pp_gui.AutoReadClock = True
End Sub
Private Sub AutoReadClock_Timer()
If (Not IsPPOpen(hPP)) Then
pp_gui.AutoReadCheck.Value = 0
pp_gui.AutoReadClock = False
GoTo finish
End If
PaintPins hPP
finish:
End Sub
Private Sub ReadRegisters_Button_Click()
If (Not IsPPOpen(hPP)) Then
GoTo finish
End If
PaintPins hPP
finish:
End Sub
Private Sub WriteControl_Button_Click()
If (Not IsPPOpen(hPP)) Then
GoTo finish
End If
g_Data = PP_ReadControl(hPP)
ask_data.Show vbModal
PP_WriteControl hPP, g_Data
PaintPins hPP
finish:
End Sub
Private Sub WriteData_Button_Click()
If (Not IsPPOpen(hPP)) Then
GoTo finish
End If
g_Data = PP_ReadData(hPP)
ask_data.Show vbModal
PP_WriteData hPP, g_Data
PaintPins hPP
finish:
End Sub
Private Function IsPPOpen(hPP As PP_HANDLE) As Boolean
Dim base_addr_index As Long
Dim base_addr As Long
base_addr_index = pp_gui.Destination.ListIndex
If (base_addr_index = 0) Then
base_addr = &H378
ElseIf (base_addr_index = 1) Then
base_addr = &H278
ElseIf (base_addr_index = 2) Then
base_addr = &H3BC
End If
If (active_base_addr = base_addr) Then
IsPPOpen = True
GoTo finish
End If
' Going to open other LPT
If (active_base_addr <> 0) Then
PP_Close hPP
End If
active_base_addr = 0
If (Not PP_Open(hPP, base_addr)) Then
IsPPOpen = False
GoTo finish
End If
' Open finished OK
active_base_addr = base_addr
PaintPins hPP
IsPPOpen = True
finish:
End Function
Private Sub PaintPins(hPP As PP_HANDLE)
Dim Data As Byte
Data = PP_ReadStatus(hPP)
pp_gui.Status.Caption = Hex(Data)
' Painting Status pins
If (Data And &H8) Then
pp_gui.Pin15.FillStyle = 0
Else
pp_gui.Pin15.FillStyle = 1
End If
If (Data And &H10) Then
pp_gui.Pin13.FillStyle = 0
Else
pp_gui.Pin13.FillStyle = 1
End If
If (Data And &H20) Then
pp_gui.Pin12.FillStyle = 0
Else
pp_gui.Pin12.FillStyle = 1
End If
If (Data And &H40) Then
pp_gui.Pin10.FillStyle = 0
Else
pp_gui.Pin10.FillStyle = 1
End If
If (Not Data And &H80) Then
pp_gui.Pin11.FillStyle = 0
Else
pp_gui.Pin11.FillStyle = 1
End If
' Painting Control pins
Data = PP_ReadControl(hPP)
pp_gui.Control.Caption = Hex(Data)
If (Not Data And &H1) Then
pp_gui.Pin1.FillStyle = 0
Else
pp_gui.Pin1.FillStyle = 1
End If
If (Not Data And &H2) Then
pp_gui.Pin14.FillStyle = 0
Else
pp_gui.Pin14.FillStyle = 1
End If
If (Data And &H4) Then
pp_gui.Pin16.FillStyle = 0
Else
pp_gui.Pin16.FillStyle = 1
End If
If (Not Data And &H8) Then
pp_gui.Pin17.FillStyle = 0
Else
pp_gui.Pin17.FillStyle = 1
End If
' Painting Data pins
Data = PP_ReadData(hPP)
pp_gui.Data.Caption = Hex(Data)
If (Data And &H1) Then
pp_gui.Pin2.FillStyle = 0
Else
pp_gui.Pin2.FillStyle = 1
End If
If (Data And &H2) Then
pp_gui.Pin3.FillStyle = 0
Else
pp_gui.Pin3.FillStyle = 1
End If
If (Data And &H4) Then
pp_gui.Pin4.FillStyle = 0
Else
pp_gui.Pin4.FillStyle = 1
End If
If (Data And &H8) Then
pp_gui.Pin5.FillStyle = 0
Else
pp_gui.Pin5.FillStyle = 1
End If
If (Data And &H10) Then
pp_gui.Pin6.FillStyle = 0
Else
pp_gui.Pin6.FillStyle = 1
End If
If (Data And &H20) Then
pp_gui.Pin7.FillStyle = 0
Else
pp_gui.Pin7.FillStyle = 1
End If
If (Data And &H40) Then
pp_gui.Pin8.FillStyle = 0
Else
pp_gui.Pin8.FillStyle = 1
End If
If (Data And &H80) Then
pp_gui.Pin9.FillStyle = 0
Else
pp_gui.Pin9.FillStyle = 1
End If
End Sub